package com.googlecode.lookie.platform;

import javax.swing.JFrame;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.richclient.application.ApplicationWindow;
import org.springframework.richclient.application.ApplicationWindowFactory;
import org.springframework.richclient.application.config.ApplicationWindowConfigurer;
import org.springframework.richclient.application.support.DefaultApplicationWindow;
import org.springframework.richclient.util.WindowUtils;

public class PlatformApplicationWindowFactory
    implements ApplicationWindowFactory
{

    private static final Log logger = LogFactory.getLog( PlatformApplicationWindowFactory.class );

    public ApplicationWindow createApplicationWindow()
    {
        logger.info( "Creating new DefaultApplicationWindow" );
        return new DefaultApplicationWindow() {

            @Override
            protected void prepareWindowForView( JFrame windowControl, ApplicationWindowConfigurer configurer )
            {
                windowControl.setSize( configurer.getInitialSize() );

                WindowUtils.centerOnScreen(windowControl);
            }



        };
    }

}
